Skip to content

refactor(web): unify tool definitions between ask agent and MCP server#1014

Open
brendan-kellam wants to merge 38 commits intomainfrom
bkellam/agent-improvements
Open

refactor(web): unify tool definitions between ask agent and MCP server#1014
brendan-kellam wants to merge 38 commits intomainfrom
bkellam/agent-improvements

Conversation

@brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Mar 18, 2026

Summary

  • Introduces a shared ToolDefinition<TName, TShape, TMetadata> abstraction in features/tools/ with a unified execute(input, context) signature and ToolResult<TMetadata> return shape
  • All tools (read_file, list_commits, list_repos, search_code, find_symbol_references, find_symbol_definitions, list_tree) are now defined once and registered with both the Vercel AI agent and the MCP server via toVercelAITool and registerMcpTool adapters
  • Adapters inject call-site context (source: 'agent' or source: 'mcp') into every tool execution
  • isReadOnly and isIdempotent hints are declared on each tool definition and forwarded to MCP annotations via registerMcpTool
  • Tool names normalized to snake_case throughout; toolNames constant eliminated in favour of xDefinition.name
  • Added list_tree tool to the Vercel AI agent with a UI component in the details card
  • Tool metadata fields normalized (repositoryrepo); webUrl added to search_code output
  • Shared logger.ts for tools; debug logging added to all tools using consistent snake_case names
  • Tool descriptions updated with usage guidance (retry on repo-not-found errors, list_repos discovery, webUrl linking)
  • Copy-to-clipboard button moved into ToolHeader so all tool components get it for free

TODO:

  • Fix search_code tool

Test plan

  • Verify ask agent tools work end-to-end (search, read file, list repos, list commits, list tree, find symbol references/definitions)
  • Verify MCP tools work end-to-end via an MCP client
  • Confirm isReadOnly/isIdempotent annotations appear in MCP tool listings (e.g. Cursor Ask mode)
  • Confirm copy button appears on hover in all tool components in the details card

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Symbol definition & reference search, repository directory-tree browser, enhanced grep code search, and a file-reading tool added.
  • Improvements
    • Tool headers now show input/output payloads and include a copy-to-clipboard action.
    • File reads display clearer line ranges, truncation/continuation info, and repo/path metadata; commit/repo listings show counts.
    • Tools unified into a consistent registry for steadier behavior.
  • Bug Fixes
    • Ask responses no longer appear in the details panel while still generating.
  • Chores
    • Support for importing plain .txt assets and improved local dev debug flag.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant